package com.trmp.base.hotelMng.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.trmp.base.hotelMng.dao.BaseHotelPriceDao;
import com.trmp.base.hotelMng.entity.BaseHotelPriceInfo;
import com.trmp.base.hotelMng.service.BaseHotelPriceService;
import com.trmp.commons.service.AbstractService;

@Service
public class BaseHotelPriceServiceImpl extends AbstractService implements BaseHotelPriceService{


	private BaseHotelPriceDao baseHotelPriceDao;
	

	public BaseHotelPriceDao getBaseHotelPriceDao() {
		return baseHotelPriceDao;
	}

	@Resource
	public void setBaseHotelPriceDao(BaseHotelPriceDao baseHotelPriceDao) {
		this.baseHotelPriceDao = baseHotelPriceDao;
	}

	@Override
	public BaseHotelPriceInfo save(BaseHotelPriceInfo baseHotelModel) {
		return baseHotelPriceDao.save(baseHotelModel);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public   void del(List<Integer> arr) {
		
		List<BaseHotelPriceInfo> ls = new ArrayList<BaseHotelPriceInfo>();
		BaseHotelPriceInfo b = null;
		for(int i :arr){
			b = new BaseHotelPriceInfo();
			b.setPriceId(i);
			ls.add(b);
		}
		baseHotelPriceDao.deleteInBatch(ls);
	}
            
	
}
